from view.iNiceRunner import INiceRunner
from view.endSrc.MySqlConn import MySqlConn
from view.endSrc.DBConfig import DBConfig


config1 = {'dsIds': [102, 103, 104, 105, 106],
           'nOb': [5] * 5,
           'clusterEstClassName': 'GaussianClustersEstimatorBy1D',
           'filterCfgJSONDict': {'KdeFilter': {'topPer': 0.5}, 'DensityPeakFilter': {'cutoffPer': 0.1}},
           'maxobList': [7, 10, 15, 30, 70],
           'minobList': [2, 2, 2, 5, 10],
           'configname': 'equal_gaussian_2d'
           }

config2 = {'dsIds': [102, 103, 104, 105, 106],
           'nOb': [5] * 5,
           'clusterEstClassName': 'GammaClustersEstimatorBy1D',
           'filterCfgJSONDict': {'KdeFilter': {'topPer': 0.5}, 'DensityPeakFilter': {'cutoffPer': 0.1}},
           'maxobList': [7, 10, 15, 30, 70],
           'minobList': [2, 2, 2, 5, 10],
           'configname': 'equal_gamma_2d'
           }

config3 = {'dsIds': [107, 108, 109],
           'nOb': [5] * 3,
           'clusterEstClassName': 'GaussianClustersEstimatorBy1D',
           'filterCfgJSONDict': {'KdeFilter': {'topPer': 0.5}, 'DensityPeakFilter': {'cutoffPer': 0.1}},
           'maxobList': [7, 15, 70],
           'minobList': [2, 2, 10],
           'configname': 'noequal_gaussian_2d'
           }

config4 = {'dsIds': [107, 108, 109],
           'nOb': [5] * 3,
           'clusterEstClassName': 'GammaClustersEstimatorBy1D',
           'filterCfgJSONDict': {'KdeFilter': {'topPer': 0.5}, 'DensityPeakFilter': {'cutoffPer': 0.1}},
           'maxobList': [7, 15, 70],
           'minobList': [2, 2, 10],
           'configname': 'noequal_gamma_2d_R1.1.0'
           }

config5 = {'dsIds': [110, 111],
           'nOb': [5, 5],
           'clusterEstClassName': 'GaussianClustersEstimatorBy1D',
           'filterCfgJSONDict': {'KdeFilter': {'topPer': 0.5}, 'DensityPeakFilter': {'cutoffPer': 0.1}},
           'maxobList': [10, 30],
           'minobList': [2, 5],
           'configname': 'noequal_gaussian_2d_2'
           }

config6 = {'dsIds': [110, 111],
           'nOb': [5, 5],
           'clusterEstClassName': 'GammaClustersEstimatorBy1D',
           'filterCfgJSONDict': {'KdeFilter': {'topPer': 0.5}, 'DensityPeakFilter': {'cutoffPer': 0.1}},
           'maxobList': [10, 30],
           'minobList': [2, 5],
           'configname': 'noequal_gamma_2d_2_R1.1.0'
           }

config7 = {'dsIds': [112, 113, 114, 115, 116],
           'nOb': [5, 5, 30, 30, 30],
           'clusterEstClassName': 'GaussianClustersEstimatorBy1D',
           'filterCfgJSONDict': {'KdeFilter': {'topPer': 0.5}, 'DensityPeakFilter': {'cutoffPer': 0.1}},
           'maxobList': [6, 6, 15, 15, 25],
           'minobList': [2, 2, 3, 3, 5],
           'configname': 'equal_gaussian_highdim'
           }

config8 = {'dsIds': [112, 113, 114, 115, 116],
           'nOb': [5, 5, 30, 30, 30],
           'clusterEstClassName': 'GammaClustersEstimatorBy1D',
           'filterCfgJSONDict': {'KdeFilter': {'topPer': 0.5}, 'DensityPeakFilter': {'cutoffPer': 0.1}},
           'maxobList': [6, 6, 15, 15, 25],
           'minobList': [2, 2, 3, 3, 5],
           'configname': 'equal_gamma_R1.1.0_highdim'
           }

config9 = {'dsIds': [117, 118, 119, 120, 121],
           'nOb': [10, 5, 30, 30, 30],
           'clusterEstClassName': 'GaussianClustersEstimatorBy1D',
           'filterCfgJSONDict': {'KdeFilter': {'topPer': 0.5}, 'DensityPeakFilter': {'cutoffPer': 0.1}},
           'maxobList': [6, 6, 15, 15, 25],
           'minobList': [2, 2, 3, 3, 5],
           'configname': 'noequal_gaussian_highdim'
           }

config10 = {'dsIds': [117, 118, 119, 120, 121],
            'nOb': [10, 5, 30, 30, 30],
            'clusterEstClassName': 'GammaClustersEstimatorBy1D',
            'filterCfgJSONDict': {'KdeFilter': {'topPer': 0.5}, 'DensityPeakFilter': {'cutoffPer': 0.1}},
            'maxobList': [6, 6, 15, 15, 25],
            'minobList': [2, 2, 3, 3, 5],
            'configname': 'noequal_gamma_R1.1.0_highdim'
            }

# ########################################################################################################
chosenConfig = config2

# ########################################################################################################
name = chosenConfig['configname']
clusterEstClassName = chosenConfig['clusterEstClassName']
dsIds = chosenConfig['dsIds']
nOb = chosenConfig['nOb']
filterCfgJSONDict = chosenConfig['filterCfgJSONDict']
maxobList = chosenConfig['maxobList']
minobList = chosenConfig['minobList']

observerGenClassName = 'EdgeObserverGenerator'
p2pClassName = 'One2OneDistance'
n2nClassName = 'N2NDistances'
sqlconn = MySqlConn(DBConfig(name))

for i, dsId in enumerate(dsIds):
    inR = INiceRunner()
    inR.setConfig(sqlConn=sqlconn, dsId=dsId, name=name, observerGenClassName=observerGenClassName,
                  nObservers=nOb[i], clusterEstimatorClassName=clusterEstClassName, one2oneClasName=p2pClassName,
                  n2nClassName=n2nClassName, filterCfgJSONDict=filterCfgJSONDict, maxob=maxobList[i], minob=minobList[i],
                  mixedParamsCfgJSONDict=None)
    inR.run()
